#include<iostream>
#include<pthread.h>
#include<sys/types.h>
#include<unistd.h>

void *run(void *arg)
{
    while(true)
    {
        std::cout << "new thread : " << getpid() << std::endl;
        sleep(1);
    }
    return nullptr;
}

int main()
{
    std::cout << "我是一个进程: pid:" << getpid() << std::endl;
    pthread_t tid;
    pthread_create(&tid,nullptr,run,(void*)"thread-1");

    while(true)
    {
        std::cout << "main thread : " << getpid() << std::endl;
        sleep(1);
    }

    return 0;
}